import json

import requests

url = "https://api.siliconflow.cn/v1/chat/completions"
API_KEY = "sk-rnqurwrjarpxjetwkcphjymkcrbxpoyhpueaxwtkevmdwhlw"

payload = {
    "model": "Qwen/QwQ-32B",
    "messages": [
        {
            "role": "user",
            "content": "给我讲一个笑话?"
        }
    ]
}
headers = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)
# 假设 response 是你通过 requests 得到的响应
json_data = response.json()

print(json_data)

# 打印标准格式的 JSON（带缩进，中文正常显示）
print(json.dumps(json_data, indent=4, ensure_ascii=False))
